/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.kungkhies.persistence.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author clayton
 */
@Entity 
@Table(name = "kspace")
@XmlRootElement
@NamedQueries(
{
    @NamedQuery(name = "Kspace.findAll", query = "SELECT k FROM Kspace k"),
    @NamedQuery(name = "Kspace.findByMessageId", query = "SELECT k FROM Kspace k WHERE k.messageId = :messageId"),
    @NamedQuery(name = "Kspace.findByTimePublished", query = "SELECT k FROM Kspace k WHERE k.timePublished = :timePublished"),
    @NamedQuery(name = "Kspace.findByMessageType", query = "SELECT k FROM Kspace k WHERE k.messageType = :messageType"),
    @NamedQuery(name = "Kspace.findByIsDisplayed", query = "SELECT k FROM Kspace k WHERE k.isDisplayed = :isDisplayed"),
    @NamedQuery(name = "Kspace.findByMessageString", query = "SELECT k FROM Kspace k WHERE k.messageString = :messageString")
})
public class Kspace implements Serializable 
{
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "message_id")
    private Long messageId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "timePublished")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timePublished;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 5)
    @Column(name = "messageType")
    private String messageType;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 5)
    @Column(name = "isDisplayed")
    private String isDisplayed;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2048)
    @Column(name = "messageString")
    private String messageString;
    @JoinColumn(name = "kungkher_id", referencedColumnName = "kungkher_id")
    @ManyToOne(optional = false)
    private Kungkher kungkherId;

    public Kspace()
    {
    }

    public Kspace(Long messageId)
    {
        this.messageId = messageId;
    }

    public Kspace(Long messageId, Date timePublished, String messageType, String isDisplayed, String messageString)
    {
        this.messageId = messageId;
        this.timePublished = timePublished;
        this.messageType = messageType;
        this.isDisplayed = isDisplayed;
        this.messageString = messageString;
    }

    public Long getMessageId()
    {
        return messageId;
    }

    public void setMessageId(Long messageId)
    {
        this.messageId = messageId;
    }

    public Date getTimePublished()
    {
        return timePublished;
    }

    public void setTimePublished(Date timePublished)
    {
        this.timePublished = timePublished;
    }

    public String getMessageType()
    {
        return messageType;
    }

    public void setMessageType(String messageType)
    {
        this.messageType = messageType;
    }

    public String getIsDisplayed()
    {
        return isDisplayed;
    }

    public void setIsDisplayed(String isDisplayed)
    {
        this.isDisplayed = isDisplayed;
    }

    public String getMessageString()
    {
        return messageString;
    }

    public void setMessageString(String messageString)
    {
        this.messageString = messageString;
    }

    public Kungkher getKungkherId()
    {
        return kungkherId;
    }

    public void setKungkherId(Kungkher kungkherId)
    {
        this.kungkherId = kungkherId;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (messageId != null ? messageId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Kspace))
        {
            return false;
        }
        Kspace other = (Kspace) object;
        if ((this.messageId == null && other.messageId != null) || (this.messageId != null && !this.messageId.equals(other.messageId)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "com.kungkhies.persistence.entities.Kspace[ messageId=" + messageId + " ]";
    }

}
